package com.springmvc.netty.action;

import com.corundumstudio.socketio.BroadcastOperations;
import com.corundumstudio.socketio.SocketIOClient;
import com.corundumstudio.socketio.SocketIOServer;
import com.springmvc.netty.command.Command;
import com.springmvc.utils.result.Result;

public class BaseAction {

	protected void sendEvent(Command command, SocketIOClient client, Object data) {
		client.sendEvent("majiang", Result.SUCCESS(command, data));
	}

	protected void sendRoomEvent(Command command, SocketIOServer server, String roomid, Object data) {
		BroadcastOperations broadcastOperations = server.getRoomOperations(roomid);
		broadcastOperations.sendEvent("majiang", Result.SUCCESS(command, data));
	}

}